home *** CD-ROM | disk | FTP | other *** search
- Path: news.umbc.edu!not-for-mail
- From: schlein@umbc.edu (Jonas J. Schlein)
- Newsgroups: comp.lang.c
- Subject: Re: Help:what is wrong this code?
- Date: 11 Apr 1996 18:43:28 -0400
- Organization: University of Maryland Baltimore County
- Message-ID: <4kk1ug$agm@umbc9.umbc.edu>
- References: <4k3p3q$n76@brahms.udel.edu>
- NNTP-Posting-Host: umbc9.umbc.edu
- NNTP-Posting-User: schlein
-
- Yue-hong Zheng <yuehong@brahms.udel.edu> wrote:
- |> Why it give me 0.0000?
- |>
- |> #include <stdio.h>
- |> main () {
- |> double a=9.008;
- |> printf("%f\n",sqrt(a));
- |> return 0;
- |> }
-
- Have you tried adding the line: #include <math.h>?
-
- If printf() thinks sqrt() is returning an int and the %f format has been
- specified (as it obviously is) that would account for your problem.
- --
- "If it wasn't for C, we would be using BASI, PASAL, and OBOL."
-
- Jonas J. Schlein (schlein@gl.umbc.edu)
-